import warnings

warnings.filterwarnings("ignore")
from ultralytics import YOLO

if __name__ == "__main__":
    # model.load('yolo11n.pt') # 加载预训练权重,改进或者做对比实验时候不建议打开,因为用预训练模型整体精度没有很明显的提升
    model_cfg_file = (
        r"E:\Tunnel\workspaces\geek\mine-yolo\ultralytics\cfg\models\11\yolo11.yaml"
    )
    data_cfg_file = "data.yaml"
    output_folder = "runs/train"

    model = YOLO(model=model_cfg_file)
    model.train(
        data=data_cfg_file,
        imgsz=640,
        epochs=50,
        batch=4,
        workers=0,
        device="cpu",
        optimizer="SGD",
        close_mosaic=10,
        resume=False,
        project=output_folder,
        name="example",
        single_cls=False,
        cache=False,
    )
